<template>
	<view class="box">
		<view class="imgbox">
			<image src="../../static/image/logo.png" mode=""></image>
		</view>
		<view class="title">
			<text class="line">—</text>
			<text class="name">员工端</text>
			<text class="line">—</text>
		</view>
		<view class="inputbox">
			<image src="../../static/image/huiyuan.png" mode=""></image>
			<input type="text" value="" placeholder="请输入用户名" v-model="uername" />
		</view>
		<view class="passwordbox">
			<image src="../../static/image/huiyuan.png" mode=""></image>
			<input type="text" value="" placeholder="请输入登录密码" v-model="password"  password=""/>
		</view>
		<view class="Loginimmediately" @click="login">
			立即登入
		</view>
	</view>
</template>
<script>
	import {
		signin
	} from "../../api/api/index.js"
	export default {
		data() {
			return {
				uername: "18227948197",
				password: "1234567"
			}
		},
		methods: {
			login() {
				let data = {
					phone: this.uername,
					pwd: this.password
				}
				uni.showLoading({
					title: "登录中",
					mask: true
				})
				signin(data).then(res => {
					uni.hideLoading()
					uni.setStorageSync("identity",'worker')
					uni.redirectTo({
						url: "../home/index"
					});
					uni.setStorageSync("token",res.data.token)
				})
				
			}
		}
	}
</script>
<style scoped lang="scss">
	.box {
		position: fixed;
		top: 0;
		left: 0;
		bottom: 0;
		right: 0;
		background-color: #FFFFFF;

		.imgbox {
			margin: 20rpx auto;

			image {
				display: block;
				width: 273rpx;
				height: 230rpx;
				margin: 0 auto;
			}
		}

		.title {
			text-align: center;
			font-size: 30rpx;
			color: #000000;
			font-weight: 700;
			font-family: Microsoft YaHei;

			.name {
				margin-left: 30rpx;
				margin-right: 30rpx;
			}
		}

		.inputbox {
			width: 600rpx;
			height: 103rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 6rpx 13rpx 2rpx rgba(206, 61, 58, 0.17);
			border-radius: 52rpx;
			display: flex;
			align-items: center;
			padding-left: 35rpx;
			box-sizing: border-box;
			line-height: 103rpx;
			margin: 0 auto;
			margin-top: 116rpx;

			image {
				width: 40rpx;
				height: 44rpx;
				margin-right: 10rpx;
			}

			input {
				font-size: 30rpx;
			}
		}

		.passwordbox {
			width: 600rpx;
			height: 103rpx;
			background: #FFFFFF;
			box-shadow: 0rpx 6rpx 13rpx 2rpx rgba(209, 209, 209, 0.17);
			border-radius: 52rpx;
			display: flex;
			align-items: center;
			padding-left: 35rpx;
			box-sizing: border-box;
			line-height: 103rpx;
			margin: 0 auto;
			margin-top: 116rpx;

			image {
				width: 40rpx;
				height: 44rpx;
				margin-right: 10rpx;
			}

			input {
				font-size: 30rpx;
			}
		}

		.Loginimmediately {
			width: 600rpx;
			height: 103rpx;
			background-image: linear-gradient(-30deg,
					#ff7e65 0%,
					#ff3333 100%),
				linear-gradient(#ffffff,
					#ffffff);
			background-blend-mode: normal,
				normal;
			box-shadow: 0rpx 6rpx 13rpx 2rpx rgba(228, 31, 31, 0.35);
			border-radius: 52rpx;
			text-align: center;
			line-height: 103rpx;
			font-family: MicrosoftYaHei;
			font-size: 36rpx;
			color: #ffffff;
			margin: 94rpx auto;
		}
	}
</style>
